package com.wyh.rabbitextensionsdemo.config;

import com.wyh.rabbitextensionsdemo.constant.Constants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QosConfig {
    @Bean("qosQueue")
    public Queue qosQueue(){
        return QueueBuilder.durable(Constants.QOS_QUEUE).build();
    }

    @Bean("qosExchange")
    public DirectExchange qosExchange(){
        return ExchangeBuilder.directExchange(Constants.QOS_EXCHANGE).durable(true).build();
    }

    @Bean("qosBinding")
    public Binding qosBinding(){
        return BindingBuilder.bind(qosQueue()).to(qosExchange()).with(Constants.QOS_ROUTING_KEY);
    }
}
